﻿using System.Linq;

namespace Inovout.People.Domain
{
    public partial class Person : IPerson
    {
        public Person(string name, params Contact[] contacts)
            : this()
        {
            this.Name = name;
            foreach (Contact contact in contacts)
            {
                if (contact != null)
                {
                    Contacts.Add(contact);
                }
            }

        }
        public virtual string Email
        {
            get
            {
                Contact contact = Contacts.SingleOrDefault(c => c.Label == ContactMethod.EMail);
                return contact == null ? null : contact.Value;
            }
        }
    }
}
